Kanzi runtime infrastructure for an Android application. More...
Classes | |
class | Reference |
Manages the lifetime of the com.rightware.kanzi.KanziRuntime in one process. More... | |
Public Member Functions | |
void | enableSuspendedChangeTrackingTask (boolean enable) |
Enables monitoring of external changes during suspension using a task on the Android Choreographer, this is disabled by default. | |
void | executeNativeGarbageCollection () |
Executes the native garbage collection manually. | |
Domain | getDomain () |
Returns the Kanzi UI domain that was created for this runtime. | |
long | getNative () |
Gets a pointer to the backing C++ instance. | |
void | loadKzb (String fileName) throws FileNotFoundException |
Loads a kzb file from the file system, if the file is not already loaded. | |
void | scheduleNativeGarbageCollection (long delayInMs) |
Schedules automatic garbage collection of native objects to occur on given interval. | |
void | setResourceDirectory (String path) |
Sets the source directory for kzb file reading and relative file reading performed through file resource protocol. | |
void | setSuspendedChangeCheckRate (Duration interval) |
Sets the rate at which Kanzi checks for outside changes when it is suspended and runs a task on the Choreographer to track suck changes. | |
void | stopNativeGarbageCollection () |
Cancels automatic garbage collection of native objects started by com.rightware.kanzi.KanziRuntime#scheduleNativeGarbageCollection(long) . | |
Static Public Member Functions | |
static Reference | acquire (Context context) |
Acquire a Reference to the com.rightware.kanzi.KanziRuntime . | |
Kanzi runtime infrastructure for an Android application.
|
static |
Acquire a Reference to the com.rightware.kanzi.KanziRuntime
.
If KanziRuntime is not already initialized, you initialize it when you call this function.
context | The Android context used by the Kanzi Runtime. Can be an Activity or an Application Context. |
void enableSuspendedChangeTrackingTask | ( | boolean | enable | ) |
Enables monitoring of external changes during suspension using a task on the Android Choreographer, this is disabled by default.
When enabled, Kanzi checks for external changes at the interval set by com.rightware.kanzi.KanziRuntime#setSuspendedChangeCheckRate(Duration)
, otherwise subscribes to android.os.MessageQueue.IdleHandler to track such changes. By enabling this you can control how quickly Kanzi wakes up on a external change when suspended at the cost of never reaching zero CPU usage in suspension.
enable | If true, Kanzi checks for external changes with a task on the Choreographer, otherwise uses a system idle event callback. |
void executeNativeGarbageCollection | ( | ) |
Executes the native garbage collection manually.
This operation can be set to be performed periodically by calling com.rightware.kanzi.KanziRuntime#scheduleNativeGarbageCollection(long)
.
Domain getDomain | ( | ) |
Returns the Kanzi UI domain that was created for this runtime.
long getNative | ( | ) |
Gets a pointer to the backing C++ instance.
void loadKzb | ( | String | fileName | ) | throws FileNotFoundException |
Loads a kzb file from the file system, if the file is not already loaded.
You can also pass a cfg file that contains a list of kzb files that you want to load. To load additional kzb files with the same name, use ResourceManager::addKzbFile(String).
fileName | The name of the kzb file to load. |
InvalidKzbFileException | Throws an InvalidKzbFileException when the kzb file is invalid. |
FileNotFoundException | Throws a FileNotFoundException when the kzb file is not found. |
void scheduleNativeGarbageCollection | ( | long | delayInMs | ) |
Schedules automatic garbage collection of native objects to occur on given interval.
In case the automatic garbage collection is not desired, it must be called manually.
delayInMs | Interval for garbage collection, in milliseconds. |
void setResourceDirectory | ( | String | path | ) |
Sets the source directory for kzb file reading and relative file reading performed through file resource protocol.
When set to empty string, APK assets directory is used as the source directory. This is the default value.
path | The path to use. |
void setSuspendedChangeCheckRate | ( | Duration | interval | ) |
Sets the rate at which Kanzi checks for outside changes when it is suspended and runs a task on the Choreographer to track suck changes.
When set to default value of 0, Kanzi uses the Choreographer frame callback which runs at the rate of display refresh. By setting this to a higher interval, you can reduce the CPU consumption when Kanzi is suspended, at the cost of delayed wake up on change. This does not affect the rate of rendering and animation. Kanzi ignores this setting when it uses android.os.MessageQueue.IdleHandler for tracking external changes.
interval | The length of time after which to check for changes when suspended. |